﻿@{
    ViewBag.Title = "GroupAll";
    Layout = "~/Views/Shared/_index.cshtml";
}

<div id="content-container" class="container">
    <div class="row">
        <div class="col-md-8">
            <div class="panel panel-default">
                <div class="panel-heading">
                    热门小组
                    <a href="/Group/SearchGroup" class="more"><i class="es-icon es-icon-morehoriz">...</i></a>
                </div>
                <div class="panel-body">
                    <div class="row group-grids">
                        @foreach (var item in ViewBag.DAO as List<LeEdu.MODEL.Group>)
                        {
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-4 grid">
                            <p>
                                <a href="/Group/GroupHomepage/@item.GroupID" title="@item.GNAME">
                                    <img src="http://localhost:5130/Img/@item.GLOGO" alt="@item.GNAME" class="avatar-square-sm">
                                </a>
                            </p>
                            <p class="title"><a class="link-light" href="/Group/GroupHomepage/@item.GroupID" title="SIZU ">@item.GNAME </a></p>
                        </div>
                        }
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">最近话题</div>
                <div class="panel-body">
                    <ul class="media-list thread-list">
                        @if (ViewBag.HUA.Count > 0)
                        {
                            foreach (var item in ViewBag.HUA as List<LeEdu.MODEL.Topicshi>)
                            {
                                <li class="media">
                                    <a class="pull-left js-user-card" href="/Group/SreachTopic/@item.ID" data-card-url="#" data-user-id="4">
                                        <img class="avatar-md" src="http://localhost:5130/Img/@((item.Users).Avatar)">
                                    </a>

                                    <div class="media-body">
                                        <div class="media-heading">
                                            <a class="title" href="/Group/SreachTopic/@item.ID">@item.TTITLE</a>

                                        </div>

                                        <div class="metas">
                                            <a class="link-muted" href="/Group/GroupHomepage/@item.GroupID" title="aaaa">@item.GroupID</a>
                                            <span class="divider">•</span>
                                            <a class="link-light link-muted" href="#">@((item.Users).Uname)</a>

                                            <span class="divider">•</span>
                                            @((DateTime.Now - item.TSTARTTIME).Minutes) 分钟前
                                        </div>
                                    </div>
                                </li>
                            }

                        }
                        else
                        {
                            <li class="media">暂时没有话题！</li>
                        }

                    </ul>
                </div>
            </div>
        </div>
        <div class="col-md-4">
            @if (ViewBag.User != null )
            {
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="media">
                            <div class="media-left">
                                <a class=" js-user-card" href="#" data-card-url="/user/4/card/show" data-user-id="4">
                                    <img class="avatar-md" src="http://localhost:5130/Img/@((ViewBag.User as LeEdu.MODEL.UserInfo).Avatar)">
                                </a>

                            </div>
                            <div class="media-body">
                                <p>
                                    <a class="link-light link-light" href="#">@((ViewBag.User as LeEdu.MODEL.UserInfo).Uname)</a>
                                </p>
                                <div class="metas">
                                    @if ((ViewBag.User as LeEdu.MODEL.UserInfo).RoleId == 0)
                                    {
                                        <a href="/Group/GroupCreate" class="btn btn-primary btn-xs btn-default active" role="button">创建小组</a>
                                    }
                                    <a href="#" class="btn btn-primary btn-xs btn-default active" role="button">我的小组主页</a>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            }

            <form class="mbl" action="/Group/SearchGroup" method="post">
                <div class="input-group group-search">
                    <input name="_csrf_token" value="aff51995493c0ceeb9ddca78818419c55223e2b5" type="hidden">
                    <input class="form-control" placeholder="小组搜索" name="GNAME" type="text">
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span></button>
                    </span>
                </div>
            </form>
            @if (ViewBag.User != null )
            {
                <div class="panel panel-default">
                    <div class="panel-heading">
                        我的小组

                        <a href="/my/group/join?type=myGroup" class="more">
                            <i class="es-icon es-icon-morehoriz"></i>
                        </a>
                    </div>
                    <div class="panel-body">
                        <div class="row group-grids">
                            @if (ViewBag.Group.Count > 0)
                        {
                            foreach (var item in ViewBag.Group as List<LeEdu.MODEL.UserAndGroup>)
                            {
                        <div class="col-lg-3 col-md-4 col-sm-2 col-xs-4 grid">
                            <p>
                                <a href="/Group/GroupHomepage/@item.GroupID" title=" ">
                                    <img src="http://localhost:5130/Img/@item.GROUPS.GLOGO" alt="@((item.GROUPS.GNAME)) " class="avatar-square-sm">
                                </a>
                            </p>
                            <p class="title">
                                <a class="link-light" href="/Group/GroupHomepage/@item.GroupID" title="@((item.GROUPS.GNAME)) ">@((item.GROUPS.GNAME))</a>
                            </p>
                        </div>
                            }

                        }
                        else
                        {
                        <div class="col-lg-3 col-md-4 col-sm-2 col-xs-4 grid">
                            <p>快去加入小组吧！</p>
                        </div>
                        }

                        </div>
                    </div>
                </div>
            }
            <div class="panel panel-default">
                <div class="panel-heading">新晋小组</div>
                <div class="panel-body">
                    <ul class="media-list">
                        @if(ViewBag.ZU.Count > 0)
                        {
                            foreach (var item in ViewBag.ZU as List<LeEdu.MODEL.Group>)
                            {
                                <li class="media">
                                    <div class="media-left">
                                        <a href="/Group/GroupHomepage/@item.GroupID">
                                            <img src="http://localhost:5130/Img/@item.GLOGO" class="avatar-square-sm">
                                        </a>
                                    </div>
                                    <div class="media-body">
                                        <p>
                                            <a class="link-light" href="/Group/GroupHomepage/@item.GroupID" title="@item.GNAME">@item.GNAME</a>
                                            <span class="text-success fsn">@(item.UserAndGroup.Count) 个成员</span>
                                        </p>
                                        <p class="fsn text-muted">@item.GNAME</p>
                                    </div>
                                </li>
                            }

                        }


                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
